/************************************************************************

								Heroes IV
					  Copyright 2001, The 3DO Company

	------------------------------------------------------------------
  					       cached_grail_data_source.h

	$Header: $

	$NoKeywords: $

 ************************************************************************/

#ifndef CACHED_GRAIL_DATA_SOURCE_H_INCLUDED
#define CACHED_GRAIL_DATA_SOURCE_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "abstract_grail_data_source.h"
#include "town_type_set.h"

// -----------------------------------------------------------------------
// A grail data which fits over another grail data source & caches the
// results of the underlying source
// -----------------------------------------------------------------------
class t_cached_grail_data_source : public t_abstract_grail_data_source
{
	public:
		explicit t_cached_grail_data_source( t_abstract_grail_data_source const & original_source );

		virtual bool	gets_global_grail_effects( t_town_type alignment ) const; 

	private:
		mutable t_town_type_set					m_data;
		mutable t_town_type_set					m_data_known;
		t_abstract_grail_data_source const &	m_original_source;
};

// -----------------------------------------------------------------------
// Inline members
// -----------------------------------------------------------------------
inline t_cached_grail_data_source::t_cached_grail_data_source( t_abstract_grail_data_source const & original_source )
	:  m_original_source( original_source )
{
	m_data_known.reset();
}

#endif // CACHED_GRAIL_DATA_SOURCE_H_INCLUDED
